/**
 * Created by guosc on 2016/10/25 0025.
 */
define(["angular",
    "framework/utils/JSONPrettyFormat",
    'framework/dataGrid/DataGridModule',
    'framework/pagination/GillionPaginationModule',
    'framework/msg/GillionMsgModule'
], function (angular) {
    var PackageEditModule = angular.module("PackageEditModule", [
        'DataGridModule',
        'GillionPaginationModule',
        'GillionMsgModule']);
    PackageEditModule.controller("PackageEditController", function ($scope, Resource, $location, GillionMsg, GillionMsgService) {
        var Projects = Resource("/grule-manager/packages");
        $scope.project = GillionMsgService.getInputData();
        $scope.confirm = function () {
            Projects.create($scope.project, function (response) {
                if (response.success) {
                    GillionMsgService.setOutputData(response);
                    GillionMsgService.close();
                } else {
                    GillionMsg.alert("提示", response.errorMessages);
                }
            })
        };
        $scope.cancel = function () {
            GillionMsgService.close();
        }

    });

});